import request from '../utils/request'
import config from '../config'

export function login(data) {
    return request.post('/admin/login', data)
}

export function getAdmin() {
    return request.get('/admin/admin')
}

export function changeAdminPassword(data) {
    return request.post('/admin/admin/changePassword', data)
}

export function changeAdminAvatar(data) {
    return request.post('/admin/admin/changeAvatar', data)
}

export function uploadPictureURL() {
    return config.baseURL + '/admin/upload/picture'
}

export function getCategoryList() {
    return request.get('/admin/category/list')
}

export function getCategory(params) {
    return request.get('/admin/category', { params })
}

export function addCategory(data) {
    return request.post('/admin/category/add', data)
}

export function editCategory(data) {
    return request.post('/admin/category/save', data)
}

export function delCategory(data) {
    return request.post('/admin/category/del', data)
}

export function getGoodsList(params) {
    return request.get('/admin/goods/list', { params })
}

export function getGoods(params) {
    return request.get('/admin/goods', { params })
}

export function addGoods(data) {
    return request.post('/admin/goods/add', data)
}

export function editGoods(data) {
    return request.post('/admin/goods/save', data)
}

export function delGoods(data) {
    return request.post('/admin/goods/del', data)
}